package com.funo.wcity.app.utils;

import java.util.Random;


public class RandomUtils {
    private static String[] randomValues = new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
    //, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "U", "T", "S", "O", "X", "V", "P", "Q", "R", "W", "Y", "Z" };

    public static String getCode() {
        StringBuffer str = new StringBuffer();
        for (int i = 0; i < 6; i++) {
            Double number = Math.random() * (randomValues.length - 1);
            str.append(randomValues[number.intValue()]);
        }

        return str.toString();
    }

    /**
     * @param len
     * @return
     * @Adder by  zhys 2011-11-19 下午05:24:38 
     * @Description 
     * 返回特定个数的随机整数
     */
    public static String getNumRandByLen(int len) {
        Random random = new Random();
        int lenth = 10;
        int lenth_ = 10;
        for(int i=0;i<len;i++){
            lenth_ = lenth_ * lenth;
        } 
        String strRan = String.valueOf(random.nextInt(lenth_)); 
        return strRan;
    }
}
